package asia.lxq.cic.controller;

import asia.lxq.cic.dao.AreaMapper;
import asia.lxq.cic.entity.Area;
import asia.lxq.cic.entity.College;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/location")
public class LocationController {

    @Autowired
    AreaMapper areaMapper;

    @GetMapping("/province")
    List<Area> getProvince(){
        return areaMapper.selectProvince();
    }

    @GetMapping("/area")
    List<Area> getArea(int parentId){
        return areaMapper.selectArea(parentId);
    }

    @GetMapping("/college")
    List<College> getArea(String area){
        return areaMapper.selectCollege(area);
    }
}
